package com.haofengsoft.scce.dialog;

import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import com.haofengsoft.scce.LoginActivity;
import com.haofengsoft.scce.R;

/**
 * Created by admin on 2015/7/24.
 */
public class NoLoginPromptDialog extends AlertDialog {
    private Context context;

    public NoLoginPromptDialog(Context context) {
        super(context);
        this.context = context;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_no_login_prompt);
        setCanceledOnTouchOutside(true);
        getWindow().setGravity(Gravity.CENTER);
        Button loginBtn = (Button) findViewById(R.id.no_login_propmt_btn);
        loginBtn.setOnClickListener(new LoginOnClickListener());
    }

    class LoginOnClickListener implements View.OnClickListener {

        @Override
        public void onClick(View view) {
            dismiss();
            Intent intent = new Intent(context, LoginActivity.class);
            context.startActivity(intent);

        }
    }
}
